@echo off

rem %1 = database server name
rem %2 = database name

@echo on

@echo ********************************************************************************
@echo Creating NavigantPortal stored procedures...
@echo off
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SendNoticeQueueInsert.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SendNoticeQueueGetAll.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SendNoticeQueueDelete.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SendNoticeHistoryInsert.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetBySite.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetBySiteCollection.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetBySiteCustodian.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetBySiteNoticeCustodian.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryInsert.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryInsertNew.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryUpdateAcknowledgement.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\UrlDictionaryEntryGet.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\UrlDictionaryEntryCreate.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetUnconfirmed.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetUnconfirmedByNewSite.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryUpdateSent.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryUpdateTries.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryAttachmentInsert.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByNoticeID.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetBySitePaged.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByNewSitePaged.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByNewSite.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByNewSiteCustodian.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByNewSiteNoticeCustodian.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByID.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\PreservationNoticeHistoryGetByIdentifier.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SmtpLogEntryGet.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SmtpLogEntryGetWithAllCodes.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SendNoticeQueueGetOne.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\SendNoticeQueueGetOneNewSite.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\InetLogUpdatePreservationNoticeHistoryID.sql"
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueGetByID.sql
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueDelete.sql
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueInsert.sql
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueUpdate.sql
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueItemInsert.sql
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueItemUpdate.sql
osql -S %1 -b -E -n -d %2 -i "..\Stored Procedures\RemindersQueueGetBySiteCollectionID.sql

rem if ERRORLEVEL 1 exit 1

@echo on
@echo ********************************************************************************

@echo.

@echo ********************************************************************************
@echo Setting permissions on NavigantPortal stored procedures...
@echo off
osql -S %1 -b -E -n -d %2 -i "..\Security\StoredProcedurePermissions.sql"
rem if ERRORLEVEL 1 exit 1
@echo on
@echo ********************************************************************************

@echo.

@echo off


pause

